@extends('admin/user/layout')

@if($menu='userLog')@endif

@section('main')
    <div class="page-header clearfix">
        <h1 class="pull-left">用户登录日志</h1>
    </div>
    <form action="" class="well well-sm form-inline" method="get">
        <div class="form-group">
            <select name="search[keyword_type]" class="form-control">
                <option value="name" @if(Input::get('search')['keyword_type'] == 'name') selected @endif>用户名</option>
                <option value="email" @if(Input::get('search')['keyword_type'] == 'email') selected @endif>邮箱</option>
                <option value="mobile" @if(Input::get('search')['keyword_type'] == 'mobile') selected @endif>手机号</option>
            </select>
        </div>
        <div class="form-group">
            <input class="form-control" name="search[keywords]" type="text" placeholder="" value="{{ Input::get('search')['keywords'] }}">
        </div>
        <button class="btn btn-primary" type="submit">搜索</button>
    </form>
    <table class="table table-striped">
        <tr>
            <th>用户名</th>
            <th>Email/手机号</th>
            <th>登录时间/ip</th>
            <th>登录地点</th>
        </tr>
        @forelse($list as $vo)
            <tr>
                <td>{{ $vo->user->name }}</td>
                <td>
                    @if($vo->user->email)
                        <em class="glyphicon glyphicon-envelope"></em> {{ $vo->user->email}}
                    @else
                        <em class="glyphicon glyphicon-earphone"></em> {{ $vo->user->mobile}}
                    @endif
                </td>
                <td>
                    <span class="text-sm">{{ date('Y-m-d H:i:s',$vo->create_time) }}</span>
                    <br>
                    <span class="text-muted text-sm">
                    <a class="text-muted text-sm" href="http://www.baidu.com/s?wd={{ $vo->ip }}" target="_blank">{{ $vo->ip }}</a>
                  </span>
                </td>
                <td>
                    {{ getIpName($vo->ip) }}
                </td>
            </tr>
        @empty
            <tr>
                <td colspan="20">
                    <div class="empty">暂无页面记录</div>
                </td>
            </tr>
        @endforelse
    </table>
    <?php echo $list->appends(Request::all())->render(); ?>

@endsection